<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/6/25
 * Time: 21:41
 */

session_start();
$token = md5(time());
$_SESSION['token'] = $token;
echo "Hello World";

?>
<script src="1.js"></script>
<input type="hidden" value="<?= isset( $token ) ? $token : '' ?>">

<script type="text/javascript">
    ajax.post("3.php", {
        "token": "<?=$token?>",
        "name": "zhangrongxiang"
    }, function (result) {
        console.log(result)
    });

    ajax.get("3.php",
        'token=<?=$token?>&name=zhangrongxiang', function (result) {
            console.log(result)
        });
</script>